﻿using MediatR;
using SystemWFH.API.Application.Command.MaintenanceCommand;
using SystemWFH.Domain;
using SystemWFH.Infrstructer.Impl;
using SystemWFH.Infrstructer.Interface;

namespace SystemWFH.API.Application.CommandHandlers.MaintenanceCommandHandler
{
    public class MaintenanceFindCommandHandler : IRequestHandler<MaintenanceFindCommand, Maintenance>
    {
        private readonly IMaintenanceRepository maintenanceRepository;
        public MaintenanceFindCommandHandler(IMaintenanceRepository maintenanceRepository)
        {
            this.maintenanceRepository = maintenanceRepository;
        }
        /// <summary>
        /// 保养
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<Maintenance> Handle(MaintenanceFindCommand request, CancellationToken cancellationToken)
        {
            var list = await maintenanceRepository.GetValue(request.maintenanceId);
            return list;
        }
    }
}
